#include<iostream>
#include<algorithm>
using namespace std;
struct S
{
	int a, b;
};
int main()
{
	int a = 3, b = 4;

	auto add1 = [](int x1, int x2) {return x1 + x2; };

	auto add2 = [a, b]() ->int {return a + b; };
	cout << add1(a, b) << endl;
	cout << add2() << endl;

	auto swap = [](int& x1, int& x2) {
		int t = x1;
		x1 = x2;
		x2 = t;
	};
	swap(a, b);
	cout << "a==" << a << endl;
	cout << "b==" << b << endl;
	S s[3] = { {1,10},{2,3},{-1,5} };	
	sort(s, s + 3, [](const S& s1, const S& s2) {return s1.a > s2.a; });
	for (auto x : s) {
		cout << x.a << " " << x.b << endl;
	}
	return 0;
}